<?php
include ("class.php"); 
include ("db/db_connect.php"); 

include"includes/functions.php";
include"includes/biblio_js.php";

$id=$_GET["txtCo"];
if ($_GET["act"]=="cad"){
	$id=$_POST["txtCo"];
	$co_curso=$_POST["selCurso"];
	$sql="UPDATE tab_cadastrados SET co_curso=". $co_curso." WHERE co_cadastrado=".$id."";

	mysql_query($sql, $db_conn)or die("<script>\n alert('Erro ao Atualizar!'); \n history.back();\n</script>\n");

/*
######################	
Inicio - Tabela de Log
######################	
*/
//session_start();

$date=getdate();
$data= $date["year"]."-".$date["mon"]."-".$date["mday"]." ".$date["hours"].":".$date["minutes"].":".$date["seconds"];
$usuario=$_SESSION['nomeAdmin'];
$id_usuario=$_SESSION['idAdmin'];
$obs=" SQL: ".str_replace("'","\"",$sql)." ";

	$sql1="insert into tab_log(id_usuario, usuario, date, observacao) values($id_usuario,'$usuario','$data','$obs')";
	mysql_query($sql1, $db_conn);
	unset($sql1);
/*
######################	
FIM - Tabela de Log
######################	
*/			
	unset($sql);
	echo "<script>\n alert('Atualizado com sucesso!');\nwindow.opener.location='valida_inscricao_cod.php?txtCo=$id';\nwindow.close();\n</script>\n";

}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/estagio.css" rel="stylesheet" type="text/css">
<title><?php titulo(); ?></title>
<style type="text/css">
<!--
body {
	background-color: #e7e7e7;
}
#Layer1 {
	position:absolute;
	left:0px;
	top:0px;
	width:44px;
	height:60px;
	z-index:1;
}
-->
</style></head>

<body>
<div id="Layer1">
  <table width="241" height="69" cellpadding="0" cellspacing="0">
   <tr>
     <td height="18" colspan="2" bgcolor="#006633"><div align="left"><font color="#e7e7e7"  face="Verdana" size="2"><b>&nbsp;</b></font><font color="#e7e7e7"  face="Verdana" size="1"><b>Atualizar <br>&nbsp;&nbsp;&nbsp;&nbsp; Cursos</b></font></div></td>
  </tr>
   <form id="form_cursos" name="form_cursos" method="post" action="atualizar_curso_no_validar.php?act=cad">
   <input type="hidden" name="txtCo" id="txtCo" value="<?php echo $_GET["txtCo"];?>">
             <tr>
               <td width="15%" height="21" valign="middle" class="txtDescCampoInscricao">Curso:</td>
               <td width="85%" valign="bottom"><select name="selCurso" id="selCurso">
			   <?php $All->fselectCurso2();?>
                </select> </td>
      </tr>
    <tr>
      <td height="28" colspan="2" align="left" valign="bottom"><div align="center">
        <input type="button" name="Button" value="Atualizar" onclick="JavaScript: if (document.getElementById('selCurso').value ==''){ alert('Favor Selecioanr o curso desejado!'); } else { document.form_cursos.submit(); }"/>
      </div></td>
    </tr>
    </form>
  </table>
</div>
</body>
</html>
